package gedis

import "github.com/gomodule/redigo/redis"

type RedisScript struct {
	*RedisCache
}

func (c *RedisScript) Eval(script string, numKeys int, keyAndArgs ...interface{}) *Reply {
	return getReply(c.Do("eval", redis.Args{}.Add(script).Add(numKeys).Add(keyAndArgs...)...))
}

func (c *RedisScript) EvalSHA(script string, numKeys int, keyAndArgs ...interface{}) *Reply {
	return getReply(c.Do("evalsha", redis.Args{}.Add(script).Add(numKeys).Add(keyAndArgs...)...))
}

func (c *RedisScript) ScriptLoad(script string) *Reply {
	return getReply(c.Do("script", "load", script))
}

func (c *RedisScript) ScriptExists(sha ...interface{}) *Reply {
	return getReply(c.Do("script", sha...))
}

func (c *RedisScript) ScriptFlush() *Reply {
	return getReply(c.Do("script", "flush"))
}

func (c *RedisScript) ScriptKill() *Reply {
	return getReply(c.Do("script", "kill"))
}
